//职位管理有内容
import React, {Component} from 'react'
import {Image, Text, TouchableOpacity, View,} from 'react-native';

import {Cmanageres_Style as styles} from '../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';
import Cmanageres_state from './resume_state';
import worktime from '../../util/worktime';
import fmt from '../../util/fmtDateUtil';
import {common_url} from "../../util/fetch";

let Dimensions = require('Dimensions');
let width = Dimensions.get('window').width;

export default class Cmanageres_list extends Component {

    constructor(props) {            //构造器只执行一次
        super(props);
        this.state = {a: true};
    };

    render() {
        return (
            <View style={styles.manr_all}>


                {/* <SwipeRow
                    disableRightSwipe={true}
                    rightOpenValue={-50}
                    closeOnRowPress={true}
                > */}
                {/* <View style={styles.standaloneRowBack}>
                        <Text style={styles.backTextWhite}>Left</Text>
                        <Text style={styles.backTextWhite}>删除</Text>
                    </View> */}


                <View>
                    <View style={styles.manr_allin}>
                        {/* 左边 */}
                        <TouchableOpacity style={[styles.manr_left, {width: width * 0.2}]} activeOpacity={1}
                                          onPress={() => {
                                              this.props.navigation.navigate('Cresume_all', {
                                                  resumeId: this.props.resume.resumeId,
                                                  postionId: this.props.postionSend.postionId
                                              })
                                          }}
                        >
                            <Image source={
                                this.props.resume.resumeIntentField ?
                                    {uri: common_url + "uploadImg/" + this.props.resume.resumeIntentField}
                                    : require('../../img/app/boy.png')} style={styles.head}/>
                            <Text style={styles.manr_name}>{this.props.resume.resumeName}</Text>
                            <Text style={styles.manr_name2}>详情</Text>
                        </TouchableOpacity>

                        {/* 右边 */}
                        <TouchableOpacity style={[styles.manr_right,]}
                                          activeOpacity={1}
                                          onPress={() => {
                                              this.choose()
                                          }}>

                            <View style={{width: width * 0.7}}>
                                <View style={styles.manr_top}>
                                    <View style={styles.manr_eve1}>
                                        <Text style={styles.manr_pos}>{this.props.resume.resumePosition}</Text>
                                        {this.props.resume.resumeSex === 1 ?
                                            <Icon
                                                name={'md-female'}
                                                size={15}
                                                color={'#fc6866'} style={styles.manr_sex}/>
                                            :
                                            <Icon
                                                name={'md-male'}
                                                size={15}
                                                color={'#3d9ccc'} style={styles.manr_sex}/>
                                        }
                                        <Text
                                            style={styles.manr_time}>{fmt(this.props.postionSend.sendTime, 'yyyy-MM-dd HH:mm:ss')}</Text>
                                    </View>

                                    <View style={styles.manr_eve3}>
                                        <Text style={styles.manr_area}>{this.props.resume.resumeWorkspace}</Text>
                                        <Text
                                            style={styles.manr_area}>{this.resumeWorkinglife(this.props.resume.resumeWorkinglife)}年经验</Text>
                                        <Text
                                            style={styles.manr_area}>{this.resumeBirth(this.props.resume.resumeBirth)}岁</Text>
                                    </View>
                                </View>

                                <View style={styles.manr_bottom}>
                                    <View style={[styles.manr_tou, {width: width * 0.5}]}>
                                        <Text
                                            style={styles.manr_botext}>投递了{this.props.postionSend.postionName} 职位</Text>
                                    </View>
                                </View>
                            </View>
                        </TouchableOpacity>

                    </View>

                    {/* 下面的状态 */}
                    <View>
                        {this.state.a ?
                            <View/>
                            :
                            <Cmanageres_state
                                postionSendMsg={this.props.postionSend.postionSendMsg}
                                postionSend={this.props.postionSend}
                                resumes={this.props.postionSend.resumes}/>
                        }
                    </View>
                </View>

                {/* </SwipeRow> */}
            </View>
        )
    }

    aaa() {
        this.setState({
            kg: !this.state.kg
        })
    }

    choose() {
        this.setState({
            a: !this.state.a
        })
    }

    resumeWorkinglife(data) {                                    //计算时间
        let aa = worktime(data).substring(0, 4);
        let bb = worktime(new Date()).substring(0, 4);
        let sj = bb - aa;                    //页面负责运算计算年龄
        return sj
    }

    resumeBirth(data) {                                    //计算时间
        let aa = worktime(data).substring(0, 4);
        let bb = worktime(new Date()).substring(0, 4);
        let sj = bb - aa;                    //页面负责运算计算年龄
        return sj
    }

}